package com.cloudfun.campusshare.service;

import com.cloudfun.campusshare.common.constant.AttachType;
import com.cloudfun.campusshare.common.model.vo.AttachVO;
import com.cloudfun.campusshare.common.response.BaseResult;
import com.cloudfun.campusshare.entity.AttachmentEntity;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

public interface AttachmentService {


    /**
     * @return
     * @description 上传附件
     */
    BaseResult<AttachVO> uploadAttachment(AttachType type, MultipartFile file);

    /**
     * 关联附件
     *
     * @param subjectId
     * @param attachIds
     * @param attachType
     */
    void relateAttachment(String subjectId, List<String> attachIds, AttachType attachType);

    /**
     * 关联附件
     *
     * @param subjectId
     * @param attachId
     * @param attachType
     */
    void relateAttachment(String subjectId, String attachId, AttachType attachType);

    /**
     * 根据类型数组拿附件
     *
     * @param subjectId
     * @param types
     * @return
     */
    List<AttachVO> getAttachment(String subjectId, List<AttachType> types);

    /**
     * 根据类型拿附件
     *
     * @param subjectId
     * @return
     */
    List<AttachVO> getAttachment(String subjectId);

    /**
     * 根据类型拿附件
     *
     * @param subjectId
     * @param type
     * @return
     */
    List<AttachVO> getAttachment(String subjectId, AttachType type);

    /**
     * 删除附件
     *
     * @param subjectId
     * @param type
     */
    void deleteAttachment(String subjectId, AttachType type);

    /**
     * 删除附件，同时删除阿里云上的文件
     *
     * @param subjectId
     */
    void deleteAttachment(String subjectId, List<AttachType> types);

    /**
     * 删除附件，同时删除阿里云上的文件
     *
     * @param attachmentEntities
     */
    void deleteAttachment(List<AttachmentEntity> attachmentEntities);

    /**
     * 删除附件，只删除表记录，不删除阿里云上的文件
     *
     * @param subjectId
     */
    void deleteAttachmentEntity(String subjectId, List<AttachType> types);

    /**
     * 删除附件，只删除表记录，不删除阿里云上的文件
     */
    void deleteAttachmentEntity(List<AttachmentEntity> attachmentEntities);

    /**
     * 拷贝附件
     *
     * @param attachIds
     * @param dstSubjectId
     */
    void copyAttachment(List<String> attachIds, String dstSubjectId);

    /**
     * 获取附件
     *
     * @param id
     * @return
     */
    AttachmentEntity getAttach(String id);
}

